package com.sangmo.fts.common.authority.sql;

import java.lang.annotation.Annotation;
import java.util.HashMap;
import java.util.Map;

public interface INativeSupport<T extends Annotation> {

    NativeSearchFilterResult doSearchFilter(NativeSearchContext context, T annotation, int expectedRight);

    class NativeSearchFilterResult {
        boolean rejected;
        String sql;
        Map<String, Object> variables = new HashMap<>();

        public boolean isRejected() {
            return rejected;
        }

        public NativeSearchFilterResult setRejected() {
            this.rejected = true;
            this.sql = " 1 <> 1 ";
            return this;
        }

        public String getSql() {
            return sql;
        }

        public NativeSearchFilterResult setSql(String sql) {
            this.sql = sql;
            return this;
        }

        public Map<String, Object> getVariables() {
            return variables;
        }

        public void setVariables(Map<String, Object> variables) {
            this.variables = variables;
        }
    }
}
